<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>state状态</title>
</head>
<body>
    <div id="test">

    </div>

    <!-- 引入react 核心库 -->
    <script type="text/javascript" src="./js/react.development.js"></script>
    <!-- 引入react-dom 用于支持react操作dom -->
    <script type="text/javascript" src="./js/react-dom.development.js"></script>
    <!-- 引入babel 用于讲jsx转成js -->
    <script type="text/javascript" src="./js/babel.min.js"></script>

    <!-- 组 件 -->
    <script type="text/babel">
       class Weather extends React.Component{
            constructor(props) {
                super(props);
                // this.change = this.change.bind(this)
                this.state={
                    isT:true,
                    test:'我还在'
                }
            }
            change(){
                console.log(this)
                const is = this.state.isT
                this.setState({isT:!is})
            }
           render() {
               return <h2 onClick={this.change}>{this.state.isT?'点我试试':'试试就试试'}，{this.state.test}</h2>
           }
       }
       ReactDOM.render(<Weather/>,document.getElementById('test'))
    </script>
</body>

</html>